﻿using System;
using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class List12DisplayName: List12RecordItem
    {

        public List12DisplayName()
        {
        }

        public override void Read(BinaryReader reader)
        {
#if DEBUG
            ReadWriteChecker.CheckClass((a, r) => a.Read(r), (a, w)=> a.Write(w), reader, this);
#endif
            this._stListName = new XLNameUnicodeString();
            _stListName.Read(reader);
            this._stListComment = new XLUnicodeString();
            this._stListComment.Read(reader);
        }

        public override List12RecordItemType Type
        {
            get { return List12RecordItemType.List12DisplayName; }
        }

        public string ListName
        {
            get { return (string) _stListName; }
        }

        public string ListComment
        {
            get { return (string) _stListComment; }
        }

        private XLNameUnicodeString _stListName;

        private XLUnicodeString _stListComment;

        public List12DisplayName(Table table)
        {
            this._stListName = (XLNameUnicodeString)table.Name;
            this._stListComment = (XLUnicodeString)table.Comment;
        }

        public override void Write(BinaryWriter writer)
        {
            _stListName.Write(writer);
            _stListComment.Write(writer);
        }
    }
}